<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

<%--
  Created by Petro 22.12.12 23:47
--%>
<%--@elvariable id="profile" type="com.realtyreg.domain.entity.users.Profile"--%>
<fieldset>
    <table>
        <tbody>
            <tr>
                <td>
                    <c:choose>
                        <c:when test="${not empty profile.user.photo}">
                            <img src="${pageContext.request.contextPath}/images?id=${profile.user.id}" alt="${message.sender.displayedFullName}">
                        </c:when>
                        <c:otherwise>
                            <img src="/resources/image/default_avatar_200.png" alt="${message.sender.displayedFullName}">
                        </c:otherwise>
                    </c:choose>
                </td>
                <td id="profileViewRows">
                    <div class="profileViewRow">
                        <h2>${profile.user.displayedFullName}</h2>
                    </div>
                    <div class="profileViewRow">
                        <div class="label"><spring:message code="label.profile.contacts"/></div>
                        <c:if test="${not empty profile.contact}">${profile.contact}</c:if>
                    </div>
                    <div class="profileViewRow">
                        <div class="label"><spring:message code="label.profile.personal"/></div>
                        <c:if test="${not empty profile.personal}">${profile.personal}</c:if>
                    </div>
                    <div class="profileViewRow">
                        <div class="label"><spring:message code="label.profile.career"/></div>
                        <c:if test="${not empty profile.career}">${profile.career}</c:if>
                    </div>
                    <div class="profileViewRow">
                        <div class="label"><spring:message code="label.profile.specialization"/></div>
                        <c:if test="${not empty profile.specialization}">${profile.specialization}</c:if>
                    </div>
                    <div class="profileViewRow">
                        <div class="label"><spring:message code="label.profile.status"/></div>
                        <c:set var="first" value="true"/>
                        <c:forEach items="${profile.user.roles}" var="role">
                            <c:if test="${not first}">,</c:if>
                            ${role.description}
                            <c:set var="first" value="false"/>
                        </c:forEach>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
</fieldset>